cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(deepsort)

set(TRT_ROOT_DIR /home/ssy/Downloads/TensorRT-7.0.0.11)
find_package(OpenCV)
find_package(CUDA REQUIRED)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)

add_definitions(-w)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wdeprecated-declarations")
#add_definitions(-pthread -O2)
set(STDCXXFS "stdc++fs")

set(SOLUTION_DIR ${CMAKE_CURRENT_SOURCE_DIR})
message("CMAKE_CURRENT_SOURCE_DIR: " ${SOLUTION_DIR})

option(CUDA_USE_STATIC_CUDA_RUNTIME "Use Static CUDA"      OFF)
option(BUILD_FASTRT_ENGINE     "Build FastRT Engine"       ON)
option(BUILD_DEMO              "Build DEMO"                ON)
option(BUILD_FP16              "Build Engine as FP16"      ON)
option(BUILD_INT8              "Build Engine as INT8"      OFF)
option(BUILD_DYNAMIC           "Build Engine as dynamic"   OFF)

if(BUILD_INT8)
    set(INT8_CALIBRATE_DATASET_PATH "/data/Market-1501-v15.09.15/bounding_box_test/" CACHE STRING "Path to calibrate dataset(end with /)")
endif()

include_directories(${TRT_ROOT_DIR}/include)
include_directories(/usr/local/cuda/include)
include_directories(/usr/local/cuda/include/crt)

link_directories(${TRT_ROOT_DIR}/lib)
link_directories(/usr/local/cuda/lib64)

set(TRACKING_NAME tracking)
set(DETECT_NAME yolov5)
set(REID_NAME fastreid)
set(OSREID osreid)

add_subdirectory(tracking)
add_subdirectory(yolov5)
add_subdirectory(FastRT)
add_subdirectory(OsnetReid)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs/${PROJECT_NAME})

add_executable(${PROJECT_NAME} demo.cpp)
target_link_libraries(${PROJECT_NAME} ${TRACKING_NAME} ${DETECT_NAME} ${REID_NAME} ${OSREID})
#install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${SOLUTION_DIR}/bin/${PROJECT_NAME})

